//
//  YHGameLayerMap.h
//  ThunderWarriors
//
//  Created by mac on 13-6-18.
//
//

#ifndef __ThunderWarriors__YHGameLayerMap__
#define __ThunderWarriors__YHGameLayerMap__

#include "YHLayer.h"
#include "YHAutoScrollCanvas.h"


class YHGameLayerMap : public YHLayer, public YHAutoScrollCanvasDelegate{
public:
    YHGameLayerMap();
    virtual ~ YHGameLayerMap();
    virtual bool init();
    bool loadMap();

    
    virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);
    virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);
    virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);
    virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);
    virtual void visit();
    
    void beginScroll(float speed); //第一次初始化
    void resumeScroll(); //恢复滚动
    void pauseScroll();//暂停滚动
    void resetPos();
    virtual void RenderCanvas(CCPoint pos);

    
    CREATE_FUNC(YHGameLayerMap)
    CREATE_FUNC_LAYER_WITHID(YHGameLayerMap)
    DECLARE_CREATE_CLASS(YHGameLayerMap)
    
    CC_SYNTHESIZE(bool, m_isMapScrolling, IsMapScrolling)
    
private:
    CCPoint m_BeginPos;
    CCPoint m_EndPos;
    CCTouch* m_pTouch;
    CCParallaxNode* m_ViewNode;
    CCRenderTexture* m_renderCanvas;
    CCTMXTiledMap* m_tiledLandMap;
    CCTMXTiledMap* m_tiledCloudMap;
    
    YHAutoScrollCanvas* m_autoScrollCanvas;
    
  
    
    int m_iRenderIndex;
};


#endif /* defined(__ThunderWarriors__YHGameLayerMap__) */
